<%@page import="pl.org.waff.repository.Folder"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:useBean id="repository" class="pl.org.waff.repository.InMemoryContentCache" scope="application" />
<jsp:useBean id="cmswitch" class="pl.org.waff.cm.CMSwitch" scope="session" />
<jsp:useBean id="folder" class="pl.org.waff.repository.Folder" scope="request" />
<div>
    <%
        boolean isNewFolder = true;
        if (folder.getPath() == null || folder.getPath().isEmpty()) {
            folder.setParent(cmswitch.getPath());
        } else {
            isNewFolder = false;
        }
        if (isNewFolder) {%>
    <form action="folder.save.do" method="POST">
        <input name="id" value="<%=folder.getId()%>" type="hidden"/>
        <input name="parent" value="<%=folder.getParent()%>" type="hidden"/>
        Folder path: <%=folder.getParent()%> 
        <input name="name" value="<%=folder.getName()%>" type="text"/><br/>
        <button type="submit">Save</button>
    </form>
    <% } else {%>
    Folder created: <%= folder.getPath()%>
    <% }%>

</div>